TimeSerialItem CodeFormat

Gets or Sets the formatting string used to format the output text.

public string CodeFormat {get;Set}

Return value

string Formatting string

Following formatting strings are supported

[H] Print hours in 24 hour format
[HH] Print hours in 24 hour format, A single-digit hour is formatted with a leading zero.
[h] Print hours in 12 hour format
[hh] Print hours in 12 hour, A single-digit hour is formatted with a leading zero.
[m] Print Minute
[mm] Print Minute, A single-digit minute is formatted with a leading zero.
[s] Print Seconds
[ss] Print Seconds, A single-digit hour is formatted with a leading zero.
[tt] Print Am/Pm

 

Example

Copy
// Time Serial Item
TimeSerialItem timeSerialItem = new TimeSerialItem(02, 02, 02);

// To print time as "Time: 02:02:02" use the following code format
timeSerialItem.CodeFormat ="Time: [hh]:[mm]:[ss]";

serialVar1.SerialItemList.Add(new NewLineSerialItem());
serialVar1.SerialItemList.Add(timeSerialItem);